Option Explicit On 
Option Strict On
Imports System

Public Class frmPolyPoints
    Inherits System.Windows.Forms.Form
    Public Shared sLat As String = ""
    Public Shared sLong As String = ""
    Friend WithEvents button_example As System.Windows.Forms.Button
    Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
    Public Shared bUpdate As Boolean = False


#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()
        sLat = ""
        sLong = ""

        'Add any initialization after the InitializeComponent() call

    End Sub

    Public Sub New(ByVal sNorth As String, ByVal sEast As String)
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        sLat = sNorth
        sLong = sEast

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents numLat As System.Windows.Forms.NumericUpDown
    Friend WithEvents numLong As System.Windows.Forms.NumericUpDown
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.btnOK = New System.Windows.Forms.Button
        Me.btnCancel = New System.Windows.Forms.Button
        Me.numLat = New System.Windows.Forms.NumericUpDown
        Me.numLong = New System.Windows.Forms.NumericUpDown
        Me.button_example = New System.Windows.Forms.Button
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        CType(Me.numLat, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.numLong, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(16, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(168, 23)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Latitude (decimal degrees)"
        Me.ToolTip1.SetToolTip(Me.Label1, "the latitude of a point of the g-ring." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "    Domain: -90.0 <= G-Ring Latitude < = " & _
                "90.0 ")
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(16, 64)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(168, 23)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "Longitude (decimal degrees)"
        Me.ToolTip1.SetToolTip(Me.Label2, "the longitude of a point of the g-ring." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "    Domain: -180.0 <= G-Ring Longitude <" & _
                " 180.0")
        '
        'btnOK
        '
        Me.btnOK.Enabled = False
        Me.btnOK.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnOK.Image = Global.MetaDoc.My.Resources.Resources.Ok_16x16
        Me.btnOK.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnOK.Location = New System.Drawing.Point(124, 88)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.Size = New System.Drawing.Size(75, 23)
        Me.btnOK.TabIndex = 4
        Me.btnOK.Text = "OK"
        Me.btnOK.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'btnCancel
        '
        Me.btnCancel.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnCancel.Image = Global.MetaDoc.My.Resources.Resources.Cancel_16x16
        Me.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnCancel.Location = New System.Drawing.Point(205, 88)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(75, 23)
        Me.btnCancel.TabIndex = 5
        Me.btnCancel.Text = "Cancel"
        Me.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'numLat
        '
        Me.numLat.DecimalPlaces = 5
        Me.numLat.Location = New System.Drawing.Point(184, 22)
        Me.numLat.Maximum = New Decimal(New Integer() {900, 0, 0, 65536})
        Me.numLat.Minimum = New Decimal(New Integer() {900, 0, 0, -2147418112})
        Me.numLat.Name = "numLat"
        Me.numLat.Size = New System.Drawing.Size(96, 20)
        Me.numLat.TabIndex = 1
        Me.numLat.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        Me.ToolTip1.SetToolTip(Me.numLat, "the latitude of a point of the g-ring." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "    Domain: -90.0 <= G-Ring Latitude < = " & _
                "90.0 ")
        '
        'numLong
        '
        Me.numLong.DecimalPlaces = 5
        Me.numLong.Location = New System.Drawing.Point(184, 62)
        Me.numLong.Maximum = New Decimal(New Integer() {1800, 0, 0, 65536})
        Me.numLong.Minimum = New Decimal(New Integer() {179999999, 0, 0, -2147090432})
        Me.numLong.Name = "numLong"
        Me.numLong.Size = New System.Drawing.Size(96, 20)
        Me.numLong.TabIndex = 3
        Me.numLong.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        Me.ToolTip1.SetToolTip(Me.numLong, "the longitude of a point of the g-ring." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "    Domain: -180.0 <= G-Ring Longitude <" & _
                " 180.0")
        '
        'button_example
        '
        Me.button_example.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.button_example.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.button_example.Image = Global.MetaDoc.My.Resources.Resources.app_help_48x48
        Me.button_example.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.button_example.Location = New System.Drawing.Point(288, 12)
        Me.button_example.Name = "button_example"
        Me.button_example.Size = New System.Drawing.Size(110, 48)
        Me.button_example.TabIndex = 21
        Me.button_example.Text = "EXAMPLE"
        Me.button_example.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.button_example.UseVisualStyleBackColor = True
        '
        'ToolTip1
        '
        Me.ToolTip1.IsBalloon = True
        Me.ToolTip1.ShowAlways = True
        Me.ToolTip1.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info
        '
        'frmPolyPoints
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(410, 123)
        Me.ControlBox = False
        Me.Controls.Add(Me.button_example)
        Me.Controls.Add(Me.numLong)
        Me.Controls.Add(Me.numLat)
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnOK)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Name = "frmPolyPoints"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "G-Polygon Points"
        Me.ToolTip1.SetToolTip(Me, "a single geographic location.")
        CType(Me.numLat, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.numLong, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmPolyPoints_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If (sLat = "") Then
        Else
            numLat.Value = CType(sLat, Decimal)
            numLong.Value = CType(sLong, Decimal)
        End If
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        sLat = numLat.Value.ToString
        sLong = numLong.Value.ToString
        bUpdate = True
        Me.Dispose()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        bUpdate = False
        Me.Dispose()
    End Sub

    Private Sub numLat_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numLat.ValueChanged
        validateOK()
    End Sub

    Private Sub numLong_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numLong.ValueChanged
        validateOK()
    End Sub
    Private Sub validateOK()
        If numLat.Value = 0 Or numLong.Value = 0 Then btnOK.Enabled = False Else btnOK.Enabled = True
    End Sub
    Public Function getUpdated() As Boolean
        Return bUpdate
    End Function
    Public Function getLat() As String
        Return sLat
    End Function
    Public Function getLong() As String
        Return sLong
    End Function

    Private Sub button_example_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_example.Click
        Dim helpForm As dialog_help = New dialog_help("PolyPoints")
        helpForm.ShowDialog()
    End Sub
End Class
